//
//  DHIsFinishedCell.m
//  精品酒店
//
//  Created by DIANGHONG on 2018/5/10.
//  Copyright © 2018年 DIANGHONG. All rights reserved.
//

#import "DHIsFinishedCell.h"
@interface DHIsFinishedCell()
@property (weak, nonatomic) IBOutlet UILabel *orderNumLabel;
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *orderLabel;
@property (weak, nonatomic) IBOutlet UILabel *isFinishedLabel;
@property (weak, nonatomic) IBOutlet UILabel *endTimeLabel;
@property (weak, nonatomic) IBOutlet UIButton *locButton;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UIButton *commentButton;
@property (weak, nonatomic) IBOutlet UIButton *isFinishButton;


@end

@implementation DHIsFinishedCell


- (void)setModel:(DHCleanOrderModel *)model
{
    _model = model;
    
    self.orderNumLabel.text = model.order_id;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.logo]];
    self.orderLabel.text = model.title;
    self.isFinishedLabel.text = model.type;
    self.endTimeLabel.text = model.end_time;
    self.priceLabel.text = [NSString stringWithFormat:@"%@元",model.price];
    
    NSString *isFinished = (model.status.intValue == 2) ? @"已完成" : @"进行中";
    NSString *isEvaStr = (model.status.intValue == 2) ? @"去评价" : @"确认完成";
    [self.isFinishButton setTitle:isFinished forState:UIControlStateNormal];
    
    self.commentButton.hidden = !model.evaluate_status.boolValue;
    [self.commentButton setTitle:isEvaStr forState:UIControlStateNormal];
    
    [self.locButton setTitle:[NSString stringWithFormat:@"%@.%@",model.area,model.city] forState:UIControlStateNormal];
}

- (void)awakeFromNib {
    [super awakeFromNib];

   
}
#pragma mark: - 评价按钮点击监听
- (IBAction)btnGoCommectClick:(UIButton *)sender
{
    [self.delegate finishedCellDidGoCommectButtonClick:self];
}

@end
